﻿using System;
using Teigha.Core;

namespace OdaOperation.Core.Simplifier
{
    internal class DunmperVectorizer : SimplifierVectorizer
    {
        public DrawCallback m_drawCallback;

        public DrawCallback m_drawEndCallback;

        public void SetDrawCallback(DrawCallback callback)
        {
            this.m_drawCallback = callback;
        }

        public void SetDrawEndCallback(DrawCallback callback)
        {
            this.m_drawEndCallback = callback;
        }

        public override void draw(OdGiDrawable pDrawable)
        {
            MemoryTransaction value = MemoryManager.GetMemoryManager().StartTransaction();
            try
            {
                this.m_drawCallback(pDrawable, base.modelToWorldTransform());
            }
            catch (Exception)
            {
            }
            finally
            {
                MemoryManager.GetMemoryManager().StopTransaction(value);
            }
            MemoryTransaction value2 = MemoryManager.GetMemoryManager().StartTransaction();
            try
            {
                base.draw(pDrawable);
            }
            catch (Exception)
            {
            }
            finally
            {
                MemoryManager.GetMemoryManager().StopTransaction(value2);
            }
            MemoryTransaction value3 = MemoryManager.GetMemoryManager().StartTransaction();
            try
            {
                this.m_drawEndCallback(pDrawable, base.modelToWorldTransform());
            }
            catch (Exception)
            {
            }
            finally
            {
                MemoryManager.GetMemoryManager().StopTransaction(value3);
            }
        }
    }
}
